package com.wjh.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.wjh.goods.entity.GoodsEntity;

/**
 * 商品Mapper
 * 
 * @author wenjianhai
 * @date 2023/6/21
 * @since JDK 17
 */
@Mapper
public interface IGoodsMapper {
	void save(GoodsEntity goods);

	void update(GoodsEntity goods);

	void deleteById(Long id);

	void deleteByGuid(String goodsGuid);

	GoodsEntity queryById(Long id);

	GoodsEntity queryByGuid(String goodsGuid);

	List<GoodsEntity> queryAll();

	List<GoodsEntity> queryByMap(@Param("param") Map<String, Object> params);

	Integer queryCount(@Param("param") Map<String, Object> params);

	Integer isCodeExist(String goodsCode);

	GoodsEntity queryByName(String goodsName);

	/**
	 * 减库存
	 *
	 * @date 2023-06-22
	 * @param id    商品id
	 * @param stock 减的数量
	 * @since JDK 17
	 * @author wenjianhai
	 */
	void subStock(@Param("id") Long id, @Param("stock") Integer stock);
}
